﻿using System;
using System.Collections.Generic;
using System.Text;

using DotSpatial.Data ;

using DotSpatial.Topology;



namespace HaGisPack
{
    [Serializable ]
    public class FCircleShape : FShape
    {
        public FCircleShape(double r, Coordinate cen,string id):base(id)
        {

            this.ComputePoints(r,cen);
            this.ComputeKeyPts(r, cen);
 
        }

        public FCircleShape(List<Coordinate> pts, string id)
            : base(id)
        {
            this.normalPts.AddRange(pts);
            this.KeyPts.AddRange(pts);
        }



        //半径
      protected   double radius;

        //圆心
      protected   Coordinate center;

        //圆上点的个数
      int Num = 360;

        //回头加入更多的代码，包括计算关键点的代码



      protected void ComputePoints(double r, Coordinate cen)
      {
          //前面还要加入计算普通点的代码

          //SelfPoint cenpt = new SelfPoint();
          //cenpt.X = cen.X;
          //cenpt.Y = cen.Y;

          List<Coordinate> CirclePoints = new List<Coordinate>();
          CirclePoints = MyArithmetic.GetCommonPoints(cen, r, Num);

          for (int i = 0; i < Num; i++)
          {
              //Coordinate c = new Coordinate();
              //c.X = CirclePoints[i].X;
              //c.Y = CirclePoints[i].Y;
              this.normalPts.Add(CirclePoints[i]);          
          }
                              
 
      }

      protected void ComputeKeyPts(double r, Coordinate cen)
      {
          
          Coordinate keypt = new Coordinate();
          keypt = MyArithmetic.GetKeyPoint(cen, r);

          this.KeyPts.Add(cen);

          this.KeyPts.Add(keypt);
 
      }



    }
}
